package com.example.personnel_oa.controller;

import com.example.comment_oa.pojos.Interview;
import com.example.comment_oa.response.AjaxResponse;
import com.example.personnel_oa.service.InterviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("personnelOa")
public class InterviewController {
    @Autowired
    InterviewService interviewService;

    //查询全部面试数据
    @PostMapping("interview/selectInter")
   public AjaxResponse selectInter(){
        List<Interview> interviews = interviewService.selectInter();
        return AjaxResponse.success(interviews);
    }
    //根据搜索框查询
    @PostMapping("interview/sousuo")
    public AjaxResponse sousuo(@RequestBody Interview interview){
        List<Interview> interview1 = interviewService.interview(interview);
        return AjaxResponse.success(interview1);
    }
    //根据id查询面试详情
    @PostMapping("interview/interid/{interId}")
    public AjaxResponse interid(@PathVariable("interId")int interId){
        Interview interview = interviewService.interId(interId);
        return AjaxResponse.success(interview);
    }
    //关注页新增面试
    @PostMapping("interview/addInter")
    public AjaxResponse addInter(@RequestBody Interview interview){
        System.err.println(interview);
        int i = interviewService.addInter(interview);
        return AjaxResponse.success(i);
    }
    //面试中修改数据
    @PostMapping("interview/xiuugai")
    public AjaxResponse xiugai(@RequestBody Interview interview){
        int xiugai = interviewService.xiugai(interview);
        return AjaxResponse.success(xiugai);
    }
    //新增二次面试安排
    @PostMapping("interview/addInters")
    public AjaxResponse addInters(@RequestBody Interview interview){
        System.err.println("进来了吗？");
        System.err.println(interview);
        int xiugai = interviewService.addInters(interview);
        return AjaxResponse.success(xiugai);
    }
    //批量新增面试安排
    @PostMapping("interview/ddd")
    public AjaxResponse ddd(@RequestBody Interview interview){
        System.err.println("进来了吗1111111111111");
        System.err.println(interview);
        int i = interviewService.addsmianshi(interview);
        return AjaxResponse.success(i);
    }
}

